<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <script>
        function goodbye() {
            alert("感谢您访问 W3School!");
            console.log("============================>")
        }

        function changeBgColor() {
            // document.getElementById("onclick_").innerText = "改变后的内容";
            document.getElementById("onclick_").innerText = Date();
        }

        // 改变背景图片
        function changeBg() {
            var images = ["47bOOOPIC5f.jpg", "52p58PICNd6_1024.jpg", "58PIC7w58PIChft.jpg"]
            var index = 0;
            // setInterval(function () {
            //     let elements = document.getElementsByTagName("body");
            //     elements[0].style.backgroundImage = "url(" + images[index % images.length] + ")"
            //     index++;
            // }, 2000)

        }
    </script>

    <style>
        #onclick_ {
            width: 100px;
            height: 100px;
            background: darkgreen;
        }
    </style>
</head>

<body onload="changeBg()">

<h1>欢迎访问我的首页</h1>
<p>请关闭窗口，或按 F5 刷新页面。</p>

<!--                                         鼠标进入                                      鼠标离开  -->
<div id="onclick_" onclick="changeBgColor()" onmouseenter="this.style.background='white'" onmouseleave="this.style.background='darkgreen'">
原始内容
</div>

<div onclick="this.innerText=new Date()">
    原始内容
</div>
</body>
</html>
